<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: coap-server(5)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('man_coap-server.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div><div class="header">
  <div class="headertitle"><div class="title">coap-server(5)</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>coap-server</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="refentry" lang="en"><a id="id1337"></a><div class="titlepage"></div><div class="refnamediv"><h2>NAME</h2><p>coap-server — CoAP Server based on libcoap</p></div><div class="refsynopsisdiv"><a id="_synopsis"></a><h2>SYNOPSIS</h2><p><span class="strong"><strong>coap-server</strong></span> [<span class="strong"><strong>-d</strong></span> max] [<span class="strong"><strong>-g</strong></span> group] [<span class="strong"><strong>-l</strong></span> loss] [<span class="strong"><strong>-p</strong></span> port] [<span class="strong"><strong>-v</strong></span> num]
              [<span class="strong"><strong>-A</strong></span> address] [<span class="strong"><strong>-N</strong></span>]
              [[<span class="strong"><strong>-k</strong></span> key] [<span class="strong"><strong>-h</strong></span> hint]]
              [[<span class="strong"><strong>-c</strong></span> certfile] [<span class="strong"><strong>-n</strong></span>] [<span class="strong"><strong>-C</strong></span> cafile] [<span class="strong"><strong>-R</strong></span> root_cafile]]</p></div><div class="refsect1"><a id="_description"></a><h2>DESCRIPTION</h2><p><span class="strong"><strong>coap-server</strong></span> is an example server for the 'Constrained Application Protocol`
(RFC 7252).</p></div><div class="refsect1"><a id="_options_general"></a><h2>OPTIONS - General</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>-d</strong></span> max
</span></dt><dd>
   Enable support for creation of dynamic resources when doing a PUT up to a
   limit of max.  If max is reached, a 4.06 code is returned until one of the
   dynamic resources has been deleted.
</dd><dt><span class="term">
<span class="strong"><strong>-g</strong></span> group
</span></dt><dd>
   Join specified multicast <span class="emphasis"><em>group</em></span> on startup.
</dd><dt><span class="term">
<span class="strong"><strong>-p</strong></span> port
</span></dt><dd>
   The <span class="emphasis"><em>port</em></span> on the given address will be listening for incoming connections.
   If (D)TLS is supported, then <span class="emphasis"><em>port</em></span> + 1 will also be listened on for
   (D)TLS connections.
   The default port is 5683 if not given any other value.
</dd><dt><span class="term">
<span class="strong"><strong>-l</strong></span> list
</span></dt><dd>
   Fail to send some datagrams specified by a comma separated list of
   numbers or number ranges (debugging only).
</dd><dt><span class="term">
<span class="strong"><strong>-l</strong></span> loss%
</span></dt><dd>
   Randomly failed to send datagams with the specified probability - 100%
   all datagrams, 0% no datagrams (debugging only).
</dd><dt><span class="term">
<span class="strong"><strong>-v</strong></span> num
</span></dt><dd>
   The verbosity level to use (default 3, maximum is 9). Above 7, there is
   increased verbosity in GnuTLS logging.
</dd><dt><span class="term">
<span class="strong"><strong>-A</strong></span> addr
</span></dt><dd>
   The local address of the interface which the server has to listen.
</dd><dt><span class="term">
<span class="strong"><strong>-N</strong></span> 
</span></dt><dd>
   Send NON-confirmable message for \"observe\" responses. If option <span class="strong"><strong>-N</strong></span> is
   not specified, a confirmable response will be sent.  Even if set, every
   fifth response will still be sent as a confirmable response
   (RFC 7641 requirement).
</dd></dl></div></div><div class="refsect1"><a id="_options_psk"></a><h2>OPTIONS - PSK</h2><p>(If supported by underlying (D)TLS library)</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>-h</strong></span> hint
</span></dt><dd>
   Pre-shared key hint to use for inbound connections. The default is <span class="emphasis"><em>CoAP</em></span>.
   This cannot be empty if defined.
</dd><dt><span class="term">
<span class="strong"><strong>-k</strong></span> key
</span></dt><dd>
   Pre-shared key to use for inbound connections. This cannot be empty if
   defined.
   <span class="strong"><strong>Note:</strong></span> if <span class="strong"><strong>-c cafile</strong></span> is defined, you need to define <span class="strong"><strong>-k key</strong></span> as well to
   have the server support both PSK and PKI.
</dd></dl></div></div><div class="refsect1"><a id="_options_pki"></a><h2>OPTIONS - PKI</h2><p>(If supported by underlying (D)TLS library)</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>-c</strong></span> certfile
</span></dt><dd>
   Use the specified PEM file which contains the CERTIFICATE and PRIVATE
   KEY information.
   <span class="strong"><strong>Note:</strong></span> if <span class="strong"><strong>-k key</strong></span> is defined, you need to define <span class="strong"><strong>-c cafile</strong></span> as well to
   have the server support both PSK and PKI.
</dd><dt><span class="term">
<span class="strong"><strong>-n</strong></span> 
</span></dt><dd>
   Disable the requirement for clients to have defined client certificates
</dd><dt><span class="term">
<span class="strong"><strong>-C</strong></span> cafile
</span></dt><dd>
  PEM file containing the CA Certificate that was used to sign the certfile
  defined using <span class="strong"><strong>-c certfile</strong></span>.
  If defined, then the client will be given this CA Certificate during the TLS
  set up. Furthermore, this will trigger the validation of the client
  certificate. If certfile is self-signed (as defined by <span class="strong"><strong>-c certfile</strong></span>), then
  you need to have on the command line the same filename for both the certfile
  and cafile (as in  <span class="strong"><strong>-c certfile -C certfile</strong></span>) to trigger validation.
</dd><dt><span class="term">
<span class="strong"><strong>-R</strong></span> root_cafile
</span></dt><dd>
  PEM file containing the set of trusted root CAs that are to be used to
  validate the server certificate.  The <span class="strong"><strong>-C cafile</strong></span> does not have to be in
  this list and is "trusted" for the verification.
  Alternatively, this can point to a directory containing a set of CA PEM files.
</dd></dl></div></div><div class="refsect1"><a id="_examples"></a><h2>EXAMPLES</h2><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Example
</li></ul></div><pre class="screen">coap-server -A ::1</pre><p>Let the server listen on localhost (port <span class="emphasis"><em>5683</em></span>).</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Example
</li></ul></div><pre class="screen">coap-server -A ::1 -k mysecretKey -h myhint</pre><p>Let the server listen on localhost (port <span class="emphasis"><em>5683</em></span> and <span class="emphasis"><em>5684</em></span>) with the server
set up for PSK authentication.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Example
</li></ul></div><pre class="screen">coap-server -A ::1 -p 13011</pre><p>The same, except the listening port is <span class="emphasis"><em>13011</em></span> (and not the default port
<span class="emphasis"><em>5683</em></span>).</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Example
</li></ul></div><pre class="screen">coap-server -A 2001:db8:81a8:0:6ef0:dead:feed:beef -v 5</pre><p>The listening address is set to <span class="emphasis"><em>2001:db8:81a8:0:6ef0:dead:feed:beef</em></span> and the
verbosity level is set to <span class="emphasis"><em>5</em></span>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
Example
</li></ul></div><pre class="screen">coap-server -A 2001:db8:81a8:0:6ef0:dead:feed:beef -g FF02::FD</pre><p>Set listening address to <span class="emphasis"><em>2001:db8:81a8:0:6ef0:dead:feed:beef</em></span> and join the
All CoAP Nodes multicast group <span class="emphasis"><em>FF02::FD</em></span>.</p></div><div class="refsect1"><a id="_files"></a><h2>FILES</h2><p>There are no configuration files.</p></div><div class="refsect1"><a id="_exit_status"></a><h2>EXIT STATUS</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>0</strong></span>
</span></dt><dd>
   Success
</dd><dt><span class="term">
<span class="strong"><strong>1</strong></span>
</span></dt><dd>
   Failure (syntax or usage error; configuration error; document
   processing failure; unexpected error)
</dd></dl></div></div><div class="refsect1"><a id="_bugs"></a><h2>BUGS</h2><p>Please report bugs on the mailing list for libcoap:
<a class="ulink" href="mailto:libcoap-developers@lists.sourceforge.net" target="_top">libcoap-developers@lists.sourceforge.net</a></p></div><div class="refsect1"><a id="_authors"></a><h2>AUTHORS</h2><p>The libcoap project &lt;<a class="ulink" href="mailto:libcoap-developers@lists.sourceforge.net" target="_top">libcoap-developers@lists.sourceforge.net</a>&gt;</p></div></div></body></html> coap-server(5)</p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
